VT-d/ATS: correct and clean up dev_invalidate_iotlb()
authorJan Beulich <jbeulich@suse.com>
Mon, 30 Jun 2014 13:57:40 +0000 (15:57 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 30 Jun 2014 13:57:40 +0000 (15:57 +0200)
commitfd33987ba27607c3cc7da258cf1d86d21beeb735
treefcde73d6b50309242e9d9afba9d84e0abb6eb3af
parentad1746e370e4bd93bf64f555880cae7e68c24531
VT-d/ATS: correct and clean up dev_invalidate_iotlb()

While this was intended to only do cleanup (replace the two bogus
"ret |= " constructs, and a simple formatting correction), this now
also
- fixes the bit manipulations for size_order > 0
  a) correct an off-by-one in the use of size_order for shifting (till
     now double the requested size got invalidated)
  b) in fact setting bit 12 and up if necessary (without which too
     small a region might have got invalidated)
  c) making them capable of dealing with regions of 4Gb size and up
- corrects the return value handling, such that a later iteration's
  success won't clear an earlier iteration's error indication
- uses PCI_BDF2() instead of open coding it
- bail immediately on bad passed in invalidation type, rather than
  repeatedly printing the same message for each ATS-capable device, at
  once also no longer hiding that failure from the caller

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Yang Zhang <yang.z.zhang@intel.com>
xen/drivers/passthrough/vtd/x86/ats.c